package com.kang.util;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

public class TokenToUserId {


    public static Integer TokenGetUserId(String token) throws Exception {
        List<String> collect = Arrays.stream(JwtUtil.parseJWT(token).getSubject().split("-")).collect(Collectors.toList());
        return Integer.valueOf(collect.get(0));
    }


    public static String TokenToUsername(String token) throws Exception {
        List<String> collect = Arrays.stream(JwtUtil.parseJWT(token).getSubject().split("-")).collect(Collectors.toList());
        return collect.get(1);
    }

}
